# Copyright (c) 1998 Lawrence Livermore National Security, LLC and other
# HYPRE Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)

##############################################################################
#
# This file defines the following matrices and vectors:
#
#   A(0): 5-pt Laplacian       ; variable diagonal
#   P(1): 3-pt x-interpolation ; constant coefficients
#   R(2): 3-pt x-restriction   ; constant coefficients
#   P(3): 3-pt y-interpolation ; constant coefficients
#   R(4): 3-pt y-restriction   ; constant coefficients
#   A(5): 5-pt Laplacian       ; variable diagonal ; symmetric
#
#   x (0): fine grid vector     ; value = 1
#   xc(1): x-coarse grid vector ; value = 1
#   xc(2): y-coarse grid vector ; value = 1
#   y (3): fine grid vector     ; value = 0
#   yc(4): x-coarse grid vector ; value = 0
#   yc(5): y-coarse grid vector ; value = 0
#
##############################################################################

# For this driver, there is only one grid

# GridCreate: ndim nboxes
GridCreate: 2 1

# GridSetExtents: boxnum ilower(ndim) iupper(ndim)
GridSetExtents: 0 (0 0) (0 0)

# GridSetPeriodic: periodic(ndim)
GridSetPeriodic: (1 0)

###########################################################

# Matrix: nmatrices
Matrix: 6

##### Matrix A (0)

# MatrixCreate: matnum ncoeffs rmap(ndim) dmap(ndim)
MatrixCreate: 0 5 (1 1) (1 1)

# MatrixSetCoeff: matnum entry offset(ndim) value
MatrixSetCoeff: 0  0 ( 0  0)  4.0
MatrixSetCoeff: 0  1 (-1  0) -1.0
MatrixSetCoeff: 0  2 ( 1  0) -1.0
MatrixSetCoeff: 0  3 ( 0 -1) -1.0
MatrixSetCoeff: 0  4 ( 0  1) -1.0

# MatrixSetConstant: matnum nentries entries(nentries)
MatrixSetConstant: 0 4 (1 2 3 4)

# MatrixSetSymmetric: matnum symmetric
MatrixSetSymmetric: 0 0

##### Matrix P (1)

# MatrixCreate: matnum ncoeffs rmap(ndim) dmap(ndim)
MatrixCreate: 1 3 (1 1) (2 1)

# MatrixSetCoeff: matnum entry offset(ndim) value
MatrixSetCoeff: 1  0 ( 0  0)  1.0
MatrixSetCoeff: 1  1 (-1  0)  0.5
MatrixSetCoeff: 1  2 ( 1  0)  0.5

# MatrixSetConstant: matnum nentries entries(nentries)
MatrixSetConstant: 1 3 (0 1 2)

##### Matrix R (2)

# MatrixCreate: matnum ncoeffs rmap(ndim) dmap(ndim)
MatrixCreate: 2 3 (2 1) (1 1)

# MatrixSetCoeff: matnum entry offset(ndim) value
MatrixSetCoeff: 2  0 ( 0  0)  1.0
MatrixSetCoeff: 2  1 (-1  0)  0.5
MatrixSetCoeff: 2  2 ( 1  0)  0.5

# MatrixSetConstant: matnum nentries entries(nentries)
MatrixSetConstant: 2 3 (0 1 2)

##### Matrix P (3)

# MatrixCreate: matnum ncoeffs rmap(ndim) dmap(ndim)
MatrixCreate: 3 3 (1 1) (1 2)

# MatrixSetCoeff: matnum entry offset(ndim) value
MatrixSetCoeff: 3  0 ( 0  0)  1.0
MatrixSetCoeff: 3  1 ( 0 -1)  0.5
MatrixSetCoeff: 3  2 ( 0  1)  0.5

# MatrixSetConstant: matnum nentries entries(nentries)
MatrixSetConstant: 3 3 (0 1 2)

##### Matrix R (4)

# MatrixCreate: matnum ncoeffs rmap(ndim) dmap(ndim)
MatrixCreate: 4 3 (1 2) (1 1)

# MatrixSetCoeff: matnum entry offset(ndim) value
MatrixSetCoeff: 4  0 ( 0  0)  1.0
MatrixSetCoeff: 4  1 ( 0 -1)  0.5
MatrixSetCoeff: 4  2 ( 0  1)  0.5

# MatrixSetConstant: matnum nentries entries(nentries)
MatrixSetConstant: 4 3 (0 1 2)

##### Matrix A (5)

# MatrixCreate: matnum ncoeffs rmap(ndim) dmap(ndim)
MatrixCreate: 5 4 (1 1) (1 1)

# MatrixSetCoeff: matnum entry offset(ndim) value
MatrixSetCoeff: 5  0 ( 0  0)  4.0
MatrixSetCoeff: 5  1 (-1  0) -1.0
MatrixSetCoeff: 5  2 ( 1  0) -1.0
MatrixSetCoeff: 5  3 ( 0 -1) -1.0
#MatrixSetCoeff: 5  4 ( 0  1) -1.0   # Note subset of full stencil

# MatrixSetConstant: matnum nentries entries(nentries)
MatrixSetConstant: 5 3 (1 2 3)       # Note subset of full stencil

# MatrixSetSymmetric: matnum symmetric
MatrixSetSymmetric: 5 1

###########################################################

# Vector: nvectors
Vector: 6

##### Vector x (0)

# VectorCreate: vecnum map(ndim) value
VectorCreate: 0 (1 1)  1.0

##### Vector xc (1)

# VectorCreate: vecnum map(ndim) value
VectorCreate: 1 (2 1)  1.0

##### Vector xc (2)

# VectorCreate: vecnum map(ndim) value
VectorCreate: 2 (1 2)  1.0

##### Vector y (3)

# VectorCreate: vecnum map(ndim) value
VectorCreate: 3 (1 1)  0.0

##### Vector yc (4)

# VectorCreate: vecnum map(ndim) value
VectorCreate: 4 (2 1)  0.0

##### Vector yc (5)

# VectorCreate: vecnum map(ndim) value
VectorCreate: 5 (1 2)  0.0
